const http = require("http");
const url = require("url");
const fs = require("fs");
const path = require("path");
http.createServer((req, res) => {
    console.log(req.headers)
    console.log("user-agent" + req.headers["user-agent"]);
    console.log("host" + req.headers.host);
    console.log("content-type" + req.headers["content-type"])
    let urlObj = new URL(req.url, "http://192.168.174.166:3000/");
    let pathName = urlObj.pathname;
    if (pathName == "/") {
        let fileContent = fs.readFileSync("./fankui.html");
        res.writeHead(200, { "Content-Type": "text/html;charset=utf8" });
        res.end(fileContent)

    }

}).listen(8080);
